﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows8Accelerator.Core.Xaml.Html;

namespace Windows8Accelerator.Core.Xaml.Controls.RichText
{
    public class ListVisitor : ControlVisitor
    {
        public ListVisitor(SuperHtmlNode superHtmlNode, SuperHtmlNodeVisitor parentVisitor)
            : base(superHtmlNode, parentVisitor)
        {
            VisitChildren = true;
        }

        protected override void InternalVisitNode1(SuperHtmlNode htmlNode)
        {
            State.RequiresLineBreaking = true;
            State.IndentLevel++;
            switch (htmlNode.TagName)
            {
                case "ol":
                    State.OrderCount = 1;
                    break;
                case "ul":
                    State.OrderCount = null;
                    break;
            }
        }

        protected override void InternalPosVisitNode1(SuperHtmlNode htmlNode)
        {
            State.RequiresLineBreaking = true;
            State.IndentLevel--;
        }
    }
}
